package com.prs.crm.domain.store;
/**
 * 出库登记
 * @author 兰小刚
 * @version 
 * 类说明
 */
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.FlowCodeEntity;

@Entity
@Table(name = "stock_storeout")
public class StoreOut extends FlowCodeEntity {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	/**
	 * 出库主题
	 * 
	 * 
	 */
	private String titlename;
	/**
	 * 库房
	 */
	@ManyToOne
	private StoreRoom room;
	/**
	 * 出库日期
	 */
	private Date storoutdata;
	/**
	 * 出库明细
	 */
	@OneToMany(mappedBy = "storeout")
	@Cascade( { org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<StoreOutDetail> outdetails;
	/**
	 * 出库概要
	 */
	private String reark;
	
	/**
	 * 批号
	 */
	private String batchNum;
	
	private String storeOutCode;
	
//	@OneToOne(fetch=FetchType.LAZY,mappedBy="storeOut")
//	private Code code;
	
	/**
	 * 销售出库
	 */
	@Column(columnDefinition = "Integer(11) default '0'")
	private int saleContractId;
	/**
	 * 
	 * 订单退货出库
	 */
	@Column(columnDefinition = "Integer(11) default '0'")
	private int purchaseOrderId;
	
	
	public int getSaleContractId() {
		return saleContractId;
	}
	public void setSaleContractId(int saleContractId) {
		this.saleContractId = saleContractId;
	}
	public int getPurchaseOrderId() {
		return purchaseOrderId;
	}
	public void setPurchaseOrderId(int purchaseOrderId) {
		this.purchaseOrderId = purchaseOrderId;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitlename() {
		return titlename;
	}
	public void setTitlename(String titlename) {
		this.titlename = titlename;
	}
	public StoreRoom getRoom() {
		return room;
	}
	public void setRoom(StoreRoom room) {
		this.room = room;
	}
	public Date getStoroutdata() {
		return storoutdata;
	}
	public void setStoroutdata(Date storoutdata) {
		this.storoutdata = storoutdata;
	}
	public Set<StoreOutDetail> getOutdetails() {
		return outdetails;
	}
	public void setOutdetails(Set<StoreOutDetail> outdetails) {
		this.outdetails = outdetails;
	}
	public String getReark() {
		return reark;
	}
	public void setReark(String reark) {
		this.reark = reark;
	}

	public void addDetail(StoreOutDetail detail) {
		if (outdetails == null)
			outdetails = new HashSet<StoreOutDetail>();
		detail.setStoreout(this);
		outdetails.add(detail);
	}
	public String getBatchNum() {
		return batchNum;
	}
	public void setBatchNum(String batchNum) {
		this.batchNum = batchNum;
	}
//	public Code getCode() {
//		return code;
//	}
//	public void setCode(Code code) {
//		this.code = code;
//	}
	public String getStoreOutCode() {
		return storeOutCode;
	}
	public void setStoreOutCode(String storeOutCode) {
		this.storeOutCode = storeOutCode;
	}
	
	
}
